﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using Iveonik.Stemmers;
//using Iveonik;

namespace PatternTest
{
    public partial class Form1 : Form
    {
        //private SubStemmer stemmer;
        private Patterns patterns;

        public Form1()
        {
            InitializeComponent();

            //stemmer = new SubStemmer();
            patterns = new Patterns();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != null && textBox1.Text.Length > 0)
            {
                int match = patterns.Match(textBox1.Text);
                if (match >= 0)
                {
                    listBox1.Items.Clear();
                    listBox1.Items.Add(patterns[match]);
                }
            }
            /*
            foreach (string[] s in patterns.List)
            {
                string str = "";
                foreach (string r in s)
                {
                    str += r + "/";
                }
                listBox1.Items.Add(str);
            }

            
            if (textBox1.Text != null && textBox1.Text.Length > 0)
            {
                // 공백으로 split
                string[] words = stemmer.Stem(textBox1.Text);

                listBox1.Items.Clear();
                foreach (string s in words)
                {
                    listBox1.Items.Add(s);
                }
            }
             */
        }
    }
}
